﻿<Window x:Class="Co9320.NamaAlert.Extension.View.OptionWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:system="clr-namespace:System;assembly=mscorlib"
        Title="メール 設定" 
        Icon="/Plugin.Mail;component/mail_small.png"
        ShowInTaskbar="False"
        SizeToContent="WidthAndHeight" ResizeMode="NoResize" DataContextChanged="Window_DataContextChanged">

    <DockPanel Margin="5">
        <Grid DockPanel.Dock="Bottom" HorizontalAlignment="Right">
            <StackPanel Orientation="Horizontal" Margin="0 5 0 0">
                <Button Content="OK" Width="100" IsDefault="True" Click="okButton_Click" />
                <Button Content="キャンセル" Width="100" Margin="5 0 0 0" IsCancel="True" Click="cancelButton_Click" />
            </StackPanel>
        </Grid>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="200"  />
                </Grid.ColumnDefinitions>

                <Label VerticalAlignment="Center" Content="送信元 メールアドレス:"/>
                <TextBox Grid.Column="1" VerticalAlignment="Center" Text="{Binding FromMailAddress}" />
                <Label Grid.Row="1" VerticalAlignment="Center" Content="送信先 メールアドレス:"/>
                <TextBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Text="{Binding ToMailAddress}" />
                <Label Grid.Row="2" VerticalAlignment="Center" Content="SMTP サーバー:" />
                <TextBox Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" Text="{Binding SmtpServer}" />
                <Label Grid.Row="3" Content="SMTP ポート:" VerticalAlignment="Center"/>
                <TextBox Grid.Row="3" Grid.Column="1" VerticalAlignment="Center" Width="80" HorizontalAlignment="Left" Text="{Binding SmtpPort}" />
                <Label Grid.Row="4" Content="エンコード:" VerticalAlignment="Center"/>
                <ComboBox Grid.Row="4" Grid.Column="1" Margin="0 5" Width="150" HorizontalAlignment="Left" VerticalAlignment="Center" SelectedValue="{Binding TextEncoding}">
                    <system:String>UTF-8</system:String>
                    <system:String>Shift_JIS</system:String>
                    <system:String>ISO-2022-JP</system:String>
                </ComboBox>
                <CheckBox Grid.Row="5" Grid.ColumnSpan="2" Content="SSLを使用する" VerticalAlignment="Center" Margin="5 2 0 2" IsChecked="{Binding SmtpUseSsl}"  />

            </Grid>
    	    <Expander Grid.Row="1" IsExpanded="False" Header="SMTP認証" >
    		    <Grid Margin="0 0 0 10">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="200" />
                    </Grid.ColumnDefinitions>
                    
    			    <Label VerticalAlignment="Center" Content="ユーザー名:" Margin="10 0 0 0"/>
    			    <TextBox Grid.Column="1"  VerticalAlignment="Center" Text="{Binding SmtpUserName}" Name="SmtpUserName" />
    			    <Label Grid.Row="1" Content="パスワード:" VerticalAlignment="Center" Margin="10 0 0 0" />
    			    <PasswordBox Grid.Row="1" Grid.Column="1" VerticalAlignment="Center" Name="SmtpPassword" Height="{Binding ElementName=SmtpUserName, Path=ActualHeight}" PasswordChanged="SmtpPassword_PasswordChanged" />
                </Grid>
    	    </Expander>
            <Button HorizontalAlignment="Right" Grid.Row="2" Padding="2" Margin="0 0 0 10" IsEnabled="True" Command="{Binding TestSendCommand}">
                <StackPanel Orientation="Horizontal" Margin="0">
                    <Image Width="16" Height="16" VerticalAlignment="Center" Margin="5 0 5 0" Source="/Plugin.Mail;component/mail--arrow.png" />
                    <TextBlock Text="テスト送信" VerticalAlignment="Center" Margin="0 0 5 0"  />
                </StackPanel>
            </Button>
        </Grid>
       
    </DockPanel>
</Window>
